package cn.gjxblog.core.event.jdk.demo1;

import cn.gjxblog.base.ThreadUtils;

import java.util.Date;
import java.util.Observable;
import java.util.Random;
import java.util.UUID;

/**
 * 被观察者对象，相当于事件模型中的事件源
 */
public class MyObservable extends Observable {
    private String id;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public void startApplication(Date date){
        System.out.println("应用开始启动");
        ThreadUtils.sleep(10);
        System.out.println("应用起来了");
        id =UUID.randomUUID().toString();
        setChanged();
        notifyObservers(date);
    }

}
